package com.ophiux.micro.core.application;

import com.ophiux.utils.common.StringUtil;

/**
 * 用户相关请求类
 * @author chenh
 *
 */
public abstract class UserRequestDTO extends RequestDTO {

	//当前登录用户部门ID,用户ID作为基础
	public String DEPT_ID;	//前端若不传，通过USER_ID来截取 ，前端若传了，则直接使用
	
	public String USER_ID;	//前端传入，
	
	public String OPERATION_USER;	//操作人    默认和USER_ID一致
	
	public String getDEPT_ID() {
		UserIDandDeptIDHandle();
		return DEPT_ID;
	}

	public void setDEPT_ID(String dEPT_ID) {
		DEPT_ID = dEPT_ID;
	}

	public String getUSER_ID() {
		
		UserIDandDeptIDHandle();
		
		return USER_ID;
	}
	
	public String getOPERATION_USER() {
		UserIDandDeptIDHandle();
		return OPERATION_USER;
	}

	public void setOPERATION_USER(String oPERATION_USER) {
		OPERATION_USER = oPERATION_USER;
	}

	/**
	 * 2018-12-21 大改  chenh
	 * USER_ID返回改为USER_ID + DEPT_ID	中间用"_"隔开
	 */
	public void UserIDandDeptIDHandle(){
		
		if(StringUtil.isEmpty(USER_ID)) return ;
		
		String arr[] = USER_ID.split("_");
		String _uID = "";	//用户ID
		String _dID = this.DEPT_ID;	//部门ID
		_uID = arr[0];
		//如果截取出来 > 1，则说明拼接了DEPT_ID
		if(arr.length > 1 && StringUtil.isEmpty(DEPT_ID)) {
			_dID = arr[1];
		}
		USER_ID = _uID;
		DEPT_ID = _dID;
		OPERATION_USER = _uID;
	}

	public void setUSER_ID(String uSER_ID) {
		USER_ID = uSER_ID;
	}
	
	public static void main(String[] args) {
		String d = "ww";
		String arr[] = d.split("_");
		System.out.println(arr[0]);
	}
}
